package com.chenxbook;


import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.env.Environment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Description
 * <br>  定义项目启动类
 *
 * @author dongdongchen
 * @date 2020-02-28
 **/
@Slf4j
@EnableTransactionManagement
@MapperScan(value = {"com.chenxbook.modules.**.dao"})
@ComponentScan(basePackages = {"com.chenxbook.modules"})
@SpringBootApplication
@ImportResource("classpath:spring-jbpm.xml")
public class JbpmDemoApplication {

    public static void main(String[] args) throws UnknownHostException {
        log.info("============spring boot start=================");
        ConfigurableApplicationContext application = SpringApplication.run(JbpmDemoApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application jbpm-demo is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "\n\t" +
                "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
                "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
        log.info("============spring boot end=================");


    }
}